package _org;
import w3c.DTD;
import w3c.Element;
import w3c.RenderHTML;
import w3c.RenderXML;


public class RenderDevice implements RenderHTML, RenderXML {

	private RenderHTML renderHTML;
	private RenderXML renderXML;

	public RenderDevice(RenderHTML h, RenderXML x) {
		this.renderHTML = h;
		this.renderXML = x;
	}
	
	public Element dorender(Element e, DTD dtd) {
		return renderXML.dorender(e, dtd);
	}

	public Element dorender(Element e) {
		return renderHTML.dorender(e);
	}

	public DagElement render(DagElement e) {
		if (e.getKind() == "HTML") return (DagElement) dorender(e);
		else if(e.getKind() == "XML") return (DagElement) dorender(e, new DTD());
		return null;
	}

}
